// component/com-new-user/com-new-user.js
import api from "../../common/api";
import p from "../../utils/platform";
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleTest() {},
    goToselectwebsite(){
      api.readVieHouse({
        logType: 7
      })
      app.mobileLogin()
      .then(() => {
        // p.navigateTo({ url: '/pages/gatherHouse/selectWebsite/selectWebsite',})
        p.navigateTo({ url: '/pages/gatherHouse/scanAddHouse/scanAddHouse',})
      })
      .catch(() => {
        app.globalData.afterMobileAuthorCallBack = () => {
          // p.redirectTo({  url: '/pages/gatherHouse/selectWebsite/selectWebsite',})
          p.redirectTo({  url: '/pages/gatherHouse/scanAddHouse/scanAddHouse',})
        }
      })
    },
    goToviehouse(){
      api.readVieHouse({
        logType: 8
      })
      this.triggerEvent('myevent', { tabConentIndex: 2 });
    },
    goTowebview(){
      api.readVieHouse({
        logType: 9
      })
      this.triggerEvent('goWebView');
      // this.triggerEvent('goAddHouse');
    },
    closex(){
      app.globalData.newUser=false;
      api.readVieHouse({
        logType: 10
      })
      this.triggerEvent('closeNew', { newUser: false });
    }
  }
})
